import { ref } from 'vue';
import executionListenerDialog from '../components/nodePanel/property/executionListener';

export default function (element) {
  const executionListenerLength = ref(0);
  const dialogName = ref(null);

  function computedExecutionListenerLength() {
    executionListenerLength.value = element.businessObject.extensionElements?.values?.length ?? 0;
  }

  function finishExecutionListener() {
    if (dialogName.value === 'executionListenerDialog') {
      computedExecutionListenerLength();
    }
    dialogName.value = '';
  }

  return {
    executionListenerDialog,
    executionListenerLength,
    dialogName,
    computedExecutionListenerLength,
    finishExecutionListener,
  };
}
